package com.hsnn.medstgmini.pro.project.service.impl;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hsnn.medstgmini.base.dict.model.DicExperttype;
import com.hsnn.medstgmini.base.dict.model.DicSys;
import com.hsnn.medstgmini.base.std.model.StdExpert;
import com.hsnn.medstgmini.pro.project.dao.BidExpertExtractRuleDao;
import com.hsnn.medstgmini.pro.project.model.BidExpertExtractListRuleList;
import com.hsnn.medstgmini.pro.project.model.BidExpertExtractRule;
import com.hsnn.medstgmini.pro.project.model.BidExpertExtractRuleListFormLog;
import com.hsnn.medstgmini.pro.project.model.BidExpertType;
import com.hsnn.medstgmini.pro.project.model.BidProjExpert;
import com.hsnn.medstgmini.pro.project.model.form.BidExpertExtractRuleListForm;
import com.hsnn.medstgmini.pro.project.service.BidExpertExtractRuleManager;
import com.hsnn.medstgmini.util.DateUtil;
import com.hsnn.medstgmini.util.Pagination;

@Service
public class BidExpertExtractManagerImpl implements BidExpertExtractRuleManager{
	
	@Autowired
	private BidExpertExtractRuleDao expertExtractDao;
	
	
	
	/////////////////////////////////////////////////////////////////////////////////////////////////////////
	/**
	 * @category 根据规则id获取专家类型
	 * @author 徐国鹏
	 * @param String ruleId
	 * @return BidExpertExtractRule
	 */
	@Override
	public Object getExpertTypeRuleById() {
		return expertExtractDao.getExpertTypeRuleById();
	}

	/**
	 * @category 根据规则id获取最大人数
	 * @author 徐国鹏
	 * @param String ruleId
	 * @return BidExpertExtractRule
	 */
	@Override
	public List<Map<String, Object>> getRuleByIdList(String ruleId) {
		return expertExtractDao.getRuleByIdList(ruleId);
	}
	/**
	 * @category 根据规则id获取医疗机构类型
	 * @author 徐国鹏
	 * @param String ruleId
	 * @return BidExpertExtractRule
	 */
	@Override
	public List<Map<String, Object>> getHospRuleByIdList(String ruleId) {
		return expertExtractDao.getHospRuleByIdList(ruleId);
	}
	/**
	 * @category 根据规则id获取专家类型
	 * @author 徐国鹏
	 * @param String ruleId
	 * @return BidExpertExtractRule
	 */
	@Override
	public List<Map<String, Object>> getExpertRuleByIdList(String ruleId) {
		return expertExtractDao.getExpertRuleByIdList(ruleId);
	}
	
	/**
	 * @category 获取一级专家类别列表
	 * @author 徐国鹏
	 * @param fatherRuleId
	 * @return List<BidExpertExtractRule> list
	 */
	@Override
	public List<BidExpertExtractListRuleList> getSuExpertTypeByInfusion(String fatherExpertId){
		return expertExtractDao.getSuExpertTypeByInfusion(fatherExpertId);
	}
	
	/**
	 * @category 保存规则
	 * @author 徐国鹏
	 * @return RuleHospType
	 */
	@Override
	public void saveRuleByIdList(BidExpertExtractRuleListForm data) {
		expertExtractDao.saveRuleByIdList(data);
	}
	
	/**
	 * @category 保存规则医疗机构
	 * @author 徐国鹏
	 * @return RuleHospType
	 */
	@Override
	public void saveHospLevelList(BidExpertExtractRuleListForm data) {
		expertExtractDao.saveHospLevelList(data);
	}
	/**
	 * @category 保存规则专家类型
	 * @author 徐国鹏
	 * @return RuleHospType
	 */
	@Override
	public void saveExpertLevelList(BidExpertExtractRuleListForm data) {
		expertExtractDao.saveExpertLevelList(data);
	}
	/**
	 * @category 抽取规则专家分类
	 * @author 徐国鹏
	 * @return RuleHospType
	 */
	@Override
	public BidExpertType getBidExpertType(String ruleId) {
		return expertExtractDao.getBidExpertType(ruleId);
	}
	
	/**
	 * @category 执行抽取规则
	 * @author 徐国鹏
	 * @param 
	 * @return 
	 */
	@Override
	public List<BidProjExpert> executeExtractRule(List<BidExpertExtractRuleListForm> list) {
		return expertExtractDao.executeExtractRule(list);
	}

	/**
	 * @category 获取一级专家类别列表
	 * @author 徐国鹏
	 * @param fatherRuleId 
	 * @param fatherRuleId
	 * @return List<BidExpertExtractListRuleList> list
	 */
	@Override
	public List<BidExpertExtractListRuleList> getSuExpertTypeByFatherId(String fatherRuleId){
		return expertExtractDao.getSuExpertTypeByFatherId(fatherRuleId);
	}

	/**
	 * @category 抽取规则设置--规则列表
	 * @author zhouqi
	 * @param Pagination page
	 * @return BidProjExpert
	 */
	@Override
	public Pagination getExpertExtractRulePage(Pagination page) {
		return expertExtractDao.getExpertExtractRulePage(page);
	}
	
	/**
	 * @category 抽取规则设置--获取医疗机构分类(子表)
	 * @author 徐国鹏
	 * @param Pagination page
	 * @return BidProjExpert
	 */
	@Override
	public Pagination getHospTypeList(Pagination page) {
		return expertExtractDao.getHospTypeList(page);
	}
	
	/**
	 * @category 抽取专家查看--获取专家查看
	 * @author 徐国鹏
	 * @param Pagination page
	 * @return BidProjExpert
	 */
	@Override
	public Pagination getExpertExtractRulePageList(Pagination page) {
		return expertExtractDao.getExpertExtractRulePageList(page);
	}
	
	/**
	 * @category 抽取专家查看--获取专家查看(子表)
	 * @author 徐国鹏
	 * @param Pagination page
	 * @return BidProjExpert
	 */
	@Override
	public Pagination getExpertTypeRuleList(Pagination page) {
		return expertExtractDao.getExpertTypeRuleList(page);
	}
	/**
	 * @category 抽取专家查看--获取专家查看(子表)
	 * @author 徐国鹏
	 * @param Pagination page
	 * @return BidProjExpert
	 */
	@Override
	public Pagination getExperttypeRuleList(Pagination page) {
		return expertExtractDao.getExperttypeRuleList(page);
	}
	
	
	/**
	 * 
	 *@category 启用，停用
	 *@author 徐国鹏
	 *@param projId
	 *@param status
	 */
	public void switchStatus(BidExpertExtractRuleListForm data){
		expertExtractDao.switchStatus(data);
	}

	/**
	 * @category 日志详情获取医疗机构分类
	 * @author zhouqi
	 * @param extractRule
	 * @return Boolean
	 */
	@Override
	public DicSys getHospTypeById(String id) {
		return expertExtractDao.getHospTypeById(id);
	}
	
	@Override
	public BidExpertExtractRuleListForm getDicExpertTypeById(String id) {
		return expertExtractDao.getDicExpertTypeById(id);
	}
	
	@Override
	public List<Map<String, Object>> getExpertName(String id) {
		return expertExtractDao.getExpertName(id);
	}
	@Override
	public List<Map<String, Object>> getHospType(String id) {
		return expertExtractDao.getHospType(id);
	}
	
	/**
	 * @category 保存医疗机构分类
	 * @author 徐国鹏
	 * @param BidProjExpert bidProjExpert
	 * @return Boolean
	 */
	@Override
	public Boolean savaHospExpert(BidProjExpert bidExpertType) {
		return expertExtractDao.saveProjExpert(bidExpertType);
	}
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	
	/**
	 * @category 保存规抽取规则
	 * @author zhouqi
	 * @param extractRule
	 * @return Boolean
	 */
	@Override
	public Boolean saveExtractRule(BidExpertExtractRuleListForm extractRule) {
		return expertExtractDao.saveExtractRule(extractRule);
	}
	
	
	
	
	/**
	 * @category 根据规则id获取抽取规则
	 * @author zhouqi
	 * @param String ruleId
	 * @return BidExpertExtractRule
	 */
	@Override
	public BidExpertExtractRule getRuleById(String ruleId) {
		return expertExtractDao.getRuleById(ruleId);
	}
	/**
	 * @category 根据父规则id获取子类抽取规则
	 * @author zhouqi
	 * @param fatherRuleId
	 * @return List<BidExpertExtractRule> list
	 */
	@Override
	public List<BidExpertExtractRule> getRuleByFatherRuleId(String fatherRuleId) {
		return expertExtractDao.getRuleByFatherRuleId(fatherRuleId);
	}
	
	

	@Override
	public DicExperttype getDicExperttypeById(String id) {
		return expertExtractDao.getDicExperttypeById(id);
	}

	/**
	 * @category 保存项目专家关联
	 * @author zhouqi
	 * @param BidProjExpert bidProjExpert
	 * @return Boolean
	 */
	@Override
	public Boolean saveProjExpert(BidProjExpert bidExpertType) {
		return expertExtractDao.saveProjExpert(bidExpertType);
	}
	
	 /**
	 * @category 获取被抽取专家列表
	 * @author zhouqi
	 * @param Pagination page
	 * @return Pagination
	 */
	@Override
	public Pagination getExtractExpertList(Pagination page){
		return expertExtractDao.getExtractExpertList(page);
	}
	
   /**
	* @category 根据专家类别获取专家数量
	* @date 2015年8月31日14:33:46
    * @author zhouqi
	* @param Pagination page
	* @return Pagination
	*/
	@Override
	public Integer getExpertCountByType(String expertTypeId) {
		return expertExtractDao.getExpertCountByType(expertTypeId);
	}
	/**
	* @category 获取抽取日志列表
	* @date 2015年8月31日14:33:46
    * @author zhouqi
	* @param Pagination page
	* @return Pagination
	*/
	@Override
	public Pagination getExtractRuleLogList(Pagination page) {
		return expertExtractDao.getExtractRuleLogList(page);
	}
    
	/**
	* @category 获取抽取规则维护记录前后对比
	* @author zhouqi
	* @date 2015年9月1日09:59:16
	* @param Pagination page
	* @return Pagination
	*/
	@Override
	public List<BidExpertExtractRuleListFormLog> getRuleCompare(String ruleId,String updDateTime) {
		Timestamp timestamp = DateUtil.StringTime2Timestamp(updDateTime);
		return expertExtractDao.getRuleCompare(ruleId, timestamp);
	}
	
	/**
   	 * @category 根据id获取所有下级专家类别
   	 * @author zhouqi
   	 * @date 2015年9月1日10:03:52
   	 * @param String , Timestamp 
   	 * @return List<BidExpertExtractRuleLog>
   	 */
	@Override
	public List<DicExperttype> getAllSubExpertType(String id){
		return expertExtractDao.getAllSubExpertType(id);
	}
	/**
	* @category 根据专家类型id获取下面所有专家数量
    * @author zhouqi
	* @param Pagination page
	* @return Pagination
	*/
	@Override
	public Integer getAllSubExpertCountByTypeId(String expertTypeId) {
		return expertExtractDao.getAllSubExpertCountByTypeId(expertTypeId);
	}
	
	/**
	* @category 根据项目id获取所有专家
    * @author zhouqi
	* @param String id:项目id
	* @return List<StdExpert>
	*/
	@Override
	public List<StdExpert> getExpertByProjId(String id){
		return expertExtractDao.getExpertByProjId(id);
	}
	



	

	

}
